var express = require("express");
var router = express.Router();

/* GET home page. */
router.get("/", function(req, res, next) {
  res.render("index", { title: "Express" });
});

var mgs = require("mongoose");

var url = "mongodb://127.0.0.1:27017/homeIndex";
console.log(url);
mgs.connect(url, function(err) {
  if (!err) {
    console.log("+++++++++成功！");
  } else {
    console.log("---------失败！");
  }
});

let type = { name: String };
let type1 = { name: String, age: String };

var homeindexs = mgs.model("homeindexs", type);
var testCli = mgs.model("testCli", type1);

module.exports = {
  homeindexs,
  testCli,
};
